﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
using System;
using UnityEngine.Events;

public class PanelControl : MonoBehaviour
{
    public GameObject start;
    public GameObject play;
    bool isshow = false;
    bool isshow1 = true;
    Button btn_Start;
    Button btn_Option;
    Button btn_Exit;
    
    // Start is called before the first frame update
    void Start()
    {
        start.SetActive(isshow1);
        play.SetActive(isshow);

        btn_Start = transform.Find("StartBg/Start").GetComponent<Button>();
        btn_Option = transform.Find("StartBg/Option").GetComponent<Button>();
        btn_Exit = transform.Find("StartBg/Exit").GetComponent<Button>();

        btn_Start.onClick.AddListener(() => { ChangePanel(); });
        btn_Exit.onClick.AddListener(() => { GameOver(); });
    }

    private void GameOver()
    {
        Application.Quit();
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {

        }
      
    }
    void ChangePanel()
    {
        start.SetActive(isshow);
        play.SetActive(isshow1);
    }
}
